﻿<UserControl x:Class="Nox.Amuse.View.Tab"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:controls="clr-namespace:Nox.Amuse.Controls"
             xmlns:nox="clr-namespace:Nox.Amuse.View"
             mc:Ignorable="d"
             RenderOptions.BitmapScalingMode="HighQuality"
             d:DesignHeight="400"
             d:DesignWidth="566">
    <UserControl.InputBindings>
        <KeyBinding Command="{Binding ToggleHistoryStateCommand}"
                    Key="H"
                    Modifiers="Ctrl" />
        <KeyBinding Command="{Binding ShowExternalHistoryCommand}"
                    Key="H"
                    Modifiers="Ctrl+Shift" />
        <KeyBinding Command="{Binding SendLastCommandCommand}"
                    Key="Z"
                    Modifiers="Alt" />
        <KeyBinding Command="{Binding RecallPrevCommandCommand}"
                    Key="P"
                    Modifiers="Ctrl" />
        <KeyBinding Command="{Binding RecallNextCommandCommand}"
                    Key="N"
                    Modifiers="Ctrl" />

    </UserControl.InputBindings>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="100" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"
                           MinHeight="30" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="{Binding InputHeight, Mode=TwoWay, FallbackValue=130}"
                           MinHeight="40" />
        </Grid.RowDefinitions>
        <controls:BufferViewer TextOptions.TextFormattingMode="Display"
                               Document="{Binding Output}"
                               ScrollValue="{Binding OutputScrollPosition, Mode=TwoWay}"
                               IsAtBottom="{Binding IsOutputAtBottom, Mode=OneWayToSource}"
                               HorizontalScrollBarVisibility="Hidden"
                               x:Name="outputBuffer"
                               Grid.ColumnSpan="2"
                               Panel.ZIndex="5">
            <controls:BufferViewer.Resources>
                <Style TargetType="ScrollBar">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="ScrollBar">
                                <!-- Setting ViewporSize=NaN will disable autosizing of thumb -->
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="*" />
                                        <RowDefinition Height="Auto" />
                                    </Grid.RowDefinitions>
                                    <Grid.Resources>
                                        <ControlTemplate x:Key="RepeatButtonTemplate"
                                                         TargetType="RepeatButton">
                                            <Grid x:Name="Root"
                                                  Background="Transparent">
                                                <VisualStateManager.VisualStateGroups>
                                                    <VisualStateGroup x:Name="CommonStates">
                                                        <VisualState x:Name="Normal" />
                                                    </VisualStateGroup>
                                                </VisualStateManager.VisualStateGroups>
                                            </Grid>
                                        </ControlTemplate>
                                        <ControlTemplate x:Key="VerticalIncrementTemplate"
                                                         TargetType="RepeatButton">
                                            <Grid x:Name="Root">
                                                <VisualStateManager.VisualStateGroups>
                                                    <VisualStateGroup x:Name="CommonStates">
                                                        <VisualState x:Name="Normal" />
                                                        <VisualState x:Name="MouseOver">
                                                            <Storyboard>
                                                                <DoubleAnimation Duration="0:0:0"
                                                                                 Storyboard.TargetName="Background"
                                                                                 Storyboard.TargetProperty="Opacity"
                                                                                 To="1" />
                                                                <DoubleAnimation Duration="0:0:0"
                                                                                 Storyboard.TargetName="BackgroundGradient"
                                                                                 Storyboard.TargetProperty="Opacity"
                                                                                 To="1" />
                                                                <DoubleAnimation Duration="0:0:0"
                                                                                 Storyboard.TargetName="BackgroundMouseOver"
                                                                                 Storyboard.TargetProperty="Opacity"
                                                                                 To="1" />
                                                                <ColorAnimation Storyboard.TargetName="BackgroundGradient"
                                                                                Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)"
                                                                                Duration="0"
                                                                                To="#7FFFFFFF" />
                                                                <ColorAnimation Storyboard.TargetName="BackgroundGradient"
                                                                                Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)"
                                                                                Duration="0"
                                                                                To="#CCFFFFFF" />
                                                                <ColorAnimation Storyboard.TargetName="BackgroundGradient"
                                                                                Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)"
                                                                                Duration="0"
                                                                                To="#F2FFFFFF" />
                                                            </Storyboard>
                                                        </VisualState>
                                                        <VisualState x:Name="Pressed">
                                                            <Storyboard>
                                                                <DoubleAnimation Duration="0:0:0"
                                                                                 Storyboard.TargetName="Background"
                                                                                 Storyboard.TargetProperty="Opacity"
                                                                                 To="1" />
                                                                <DoubleAnimation Duration="0:0:0"
                                                                                 Storyboard.TargetName="BackgroundGradient"
                                                                                 Storyboard.TargetProperty="Opacity"
                                                                                 To="1" />
                                                                <DoubleAnimation Duration="0:0:0"
                                                                                 Storyboard.TargetName="BackgroundPressed"
                                                                                 Storyboard.TargetProperty="Opacity"
                                                                                 To="1" />
                                                                <DoubleAnimation Storyboard.TargetName="Highlight"
                                                                                 Storyboard.TargetProperty="(UIElement.Opacity)"
                                                                                 Duration="0"
                                                                                 To="1" />
                                                                <ColorAnimation Storyboard.TargetName="BackgroundGradient"
                                                                                Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)"
                                                                                Duration="0"
                                                                                To="#6BFFFFFF" />
                                                                <ColorAnimation Storyboard.TargetName="BackgroundGradient"
                                                                                Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)"
                                                                                Duration="0"
                                                                                To="#C6FFFFFF" />
                                                                <ColorAnimation Storyboard.TargetName="BackgroundGradient"
                                                                                Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)"
                                                                                Duration="0"
                                                                                To="#EAFFFFFF" />
                                                                <ColorAnimation Storyboard.TargetName="BackgroundGradient"
                                                                                Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)"
                                                                                Duration="0"
                                                                                To="#F4FFFFFF" />
                                                            </Storyboard>
                                                        </VisualState>
                                                        <VisualState x:Name="Disabled">
                                                            <Storyboard>
                                                                <DoubleAnimation Duration="0:0:0"
                                                                                 Storyboard.TargetName="DisabledElement"
                                                                                 Storyboard.TargetProperty="Opacity"
                                                                                 To=".7" />
                                                            </Storyboard>
                                                        </VisualState>
                                                    </VisualStateGroup>
                                                </VisualStateManager.VisualStateGroups>
                                                <Rectangle x:Name="Background"
                                                           Opacity="0"
                                                           RadiusX="2"
                                                           RadiusY="2"
                                                           Fill="#FF1F3B53"
                                                           StrokeThickness="1">
                                                    <Rectangle.Stroke>
                                                        <LinearGradientBrush EndPoint="1,.5"
                                                                             StartPoint="0,.5">
                                                            <GradientStop Color="#FF647480"
                                                                          Offset="1" />
                                                            <GradientStop Color="#FFAEB7BF"
                                                                          Offset="0" />
                                                            <GradientStop Color="#FF919EA7"
                                                                          Offset="0.35" />
                                                            <GradientStop Color="#FF7A8A99"
                                                                          Offset="0.35" />
                                                        </LinearGradientBrush>
                                                    </Rectangle.Stroke>
                                                </Rectangle>
                                                <Rectangle x:Name="BackgroundMouseOver"
                                                           Opacity="0"
                                                           RadiusX="2"
                                                           RadiusY="2"
                                                           Fill="#FF448DCA"
                                                           StrokeThickness="1"
                                                           Stroke="#00000000" />
                                                <Rectangle x:Name="BackgroundPressed"
                                                           Opacity="0"
                                                           RadiusX="2"
                                                           RadiusY="2"
                                                           Fill="#FF448DCA"
                                                           StrokeThickness="1"
                                                           Stroke="#00000000" />
                                                <Rectangle x:Name="BackgroundGradient"
                                                           Opacity="0"
                                                           RadiusX="1"
                                                           RadiusY="1"
                                                           StrokeThickness="1"
                                                           Margin="1"
                                                           Stroke="#FFFFFFFF">
                                                    <Rectangle.Fill>
                                                        <LinearGradientBrush StartPoint="0,.7"
                                                                             EndPoint="1,.7">
                                                            <GradientStop Color="#FFFFFFFF"
                                                                          Offset="0.013" />
                                                            <GradientStop Color="#F9FFFFFF"
                                                                          Offset="0.375" />
                                                            <GradientStop Color="#E5FFFFFF"
                                                                          Offset="0.603" />
                                                            <GradientStop Color="#C6FFFFFF"
                                                                          Offset="1" />
                                                        </LinearGradientBrush>
                                                    </Rectangle.Fill>
                                                </Rectangle>
                                                <Rectangle x:Name="Highlight"
                                                           Opacity="0"
                                                           RadiusX="1"
                                                           RadiusY="1"
                                                           IsHitTestVisible="false"
                                                           Stroke="#FF6DBDD1"
                                                           StrokeThickness="1"
                                                           Margin="1" />
                                                <Path Stretch="Uniform"
                                                      Height="4"
                                                      Width="8"
                                                      Data="F1 M 531.107,321.943L 541.537,321.943L 536.322,328.042L 531.107,321.943 Z ">
                                                    <Path.Fill>
                                                        <SolidColorBrush x:Name="ButtonColor"
                                                                         Color="#FF333333" />
                                                    </Path.Fill>
                                                </Path>
                                                <Rectangle x:Name="DisabledElement"
                                                           Opacity="0"
                                                           RadiusX="2"
                                                           RadiusY="2"
                                                           Fill="#FFFFFFFF" />
                                            </Grid>
                                        </ControlTemplate>
                                        <ControlTemplate x:Key="VerticalDecrementTemplate"
                                                         TargetType="RepeatButton">
                                            <Grid x:Name="Root">
                                                <VisualStateManager.VisualStateGroups>
                                                    <VisualStateGroup x:Name="CommonStates">
                                                        <VisualState x:Name="Normal" />
                                                        <VisualState x:Name="MouseOver">
                                                            <Storyboard>
                                                                <DoubleAnimation Duration="0:0:0"
                                                                                 Storyboard.TargetName="Background"
                                                                                 Storyboard.TargetProperty="Opacity"
                                                                                 To="1" />
                                                                <DoubleAnimation Duration="0:0:0"
                                                                                 Storyboard.TargetName="BackgroundGradient"
                                                                                 Storyboard.TargetProperty="Opacity"
                                                                                 To="1" />
                                                                <DoubleAnimation Duration="0:0:0"
                                                                                 Storyboard.TargetName="BackgroundMouseOver"
                                                                                 Storyboard.TargetProperty="Opacity"
                                                                                 To="1" />
                                                                <ColorAnimation Storyboard.TargetName="BackgroundGradient"
                                                                                Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)"
                                                                                Duration="0"
                                                                                To="#7FFFFFFF" />
                                                                <ColorAnimation Storyboard.TargetName="BackgroundGradient"
                                                                                Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)"
                                                                                Duration="0"
                                                                                To="#CCFFFFFF" />
                                                                <ColorAnimation Storyboard.TargetName="BackgroundGradient"
                                                                                Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)"
                                                                                Duration="0"
                                                                                To="#F2FFFFFF" />
                                                            </Storyboard>
                                                        </VisualState>
                                                        <VisualState x:Name="Pressed">
                                                            <Storyboard>
                                                                <DoubleAnimation Duration="0:0:0"
                                                                                 Storyboard.TargetName="Background"
                                                                                 Storyboard.TargetProperty="Opacity"
                                                                                 To="1" />
                                                                <DoubleAnimation Duration="0:0:0"
                                                                                 Storyboard.TargetName="BackgroundGradient"
                                                                                 Storyboard.TargetProperty="Opacity"
                                                                                 To="1" />
                                                                <DoubleAnimation Duration="0:0:0"
                                                                                 Storyboard.TargetName="BackgroundPressed"
                                                                                 Storyboard.TargetProperty="Opacity"
                                                                                 To="1" />
                                                                <DoubleAnimation Storyboard.TargetName="Highlight"
                                                                                 Storyboard.TargetProperty="(UIElement.Opacity)"
                                                                                 Duration="0"
                                                                                 To="1" />
                                                                <ColorAnimation Storyboard.TargetName="BackgroundGradient"
                                                                                Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)"
                                                                                Duration="0"
                                                                                To="#6BFFFFFF" />
                                                                <ColorAnimation Storyboard.TargetName="BackgroundGradient"
                                                                                Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)"
                                                                                Duration="0"
                                                                                To="#C6FFFFFF" />
                                                                <ColorAnimation Storyboard.TargetName="BackgroundGradient"
                                                                                Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)"
                                                                                Duration="0"
                                                                                To="#EAFFFFFF" />
                                                                <ColorAnimation Storyboard.TargetName="BackgroundGradient"
                                                                                Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)"
                                                                                Duration="0"
                                                                                To="#F4FFFFFF" />
                                                            </Storyboard>
                                                        </VisualState>
                                                        <VisualState x:Name="Disabled">
                                                            <Storyboard>
                                                                <DoubleAnimation Duration="0:0:0"
                                                                                 Storyboard.TargetName="DisabledElement"
                                                                                 Storyboard.TargetProperty="Opacity"
                                                                                 To=".7" />
                                                            </Storyboard>
                                                        </VisualState>
                                                    </VisualStateGroup>
                                                </VisualStateManager.VisualStateGroups>
                                                <Rectangle x:Name="Background"
                                                           Opacity="0"
                                                           RadiusX="2"
                                                           RadiusY="2"
                                                           Fill="#FF1F3B53"
                                                           StrokeThickness="1">
                                                    <Rectangle.Stroke>
                                                        <LinearGradientBrush EndPoint="1,.5"
                                                                             StartPoint="0,.5">
                                                            <GradientStop Color="#FF647480"
                                                                          Offset="1" />
                                                            <GradientStop Color="#FFAEB7BF"
                                                                          Offset="0" />
                                                            <GradientStop Color="#FF919EA7"
                                                                          Offset="0.35" />
                                                            <GradientStop Color="#FF7A8A99"
                                                                          Offset="0.35" />
                                                        </LinearGradientBrush>
                                                    </Rectangle.Stroke>
                                                </Rectangle>
                                                <Rectangle x:Name="BackgroundMouseOver"
                                                           Opacity="0"
                                                           RadiusX="2"
                                                           RadiusY="2"
                                                           Fill="#FF448DCA"
                                                           StrokeThickness="1"
                                                           Stroke="#00000000" />
                                                <Rectangle x:Name="BackgroundPressed"
                                                           Opacity="0"
                                                           RadiusX="2"
                                                           RadiusY="2"
                                                           Fill="#FF448DCA"
                                                           StrokeThickness="1"
                                                           Stroke="#00000000" />
                                                <Rectangle x:Name="BackgroundGradient"
                                                           Opacity="0"
                                                           RadiusX="1"
                                                           RadiusY="1"
                                                           StrokeThickness="1"
                                                           Margin="1"
                                                           Stroke="#FFFFFFFF">
                                                    <Rectangle.Fill>
                                                        <LinearGradientBrush StartPoint="0,.7"
                                                                             EndPoint="1,.7">
                                                            <GradientStop Color="#FFFFFFFF"
                                                                          Offset="0.013" />
                                                            <GradientStop Color="#F9FFFFFF"
                                                                          Offset="0.375" />
                                                            <GradientStop Color="#E5FFFFFF"
                                                                          Offset="0.603" />
                                                            <GradientStop Color="#C6FFFFFF"
                                                                          Offset="1" />
                                                        </LinearGradientBrush>
                                                    </Rectangle.Fill>
                                                </Rectangle>
                                                <Rectangle x:Name="Highlight"
                                                           Opacity="0"
                                                           RadiusX="1"
                                                           RadiusY="1"
                                                           IsHitTestVisible="false"
                                                           Stroke="#FF6DBDD1"
                                                           StrokeThickness="1"
                                                           Margin="1" />
                                                <Path Stretch="Uniform"
                                                      Height="4"
                                                      Width="8"
                                                      Data="F1 M 541.537,173.589L 531.107,173.589L 536.322,167.49L 541.537,173.589 Z ">
                                                    <Path.Fill>
                                                        <SolidColorBrush x:Name="ButtonColor"
                                                                         Color="#FF333333" />
                                                    </Path.Fill>
                                                </Path>
                                                <Rectangle x:Name="DisabledElement"
                                                           Opacity="0"
                                                           RadiusX="2"
                                                           RadiusY="2"
                                                           Fill="#FFFFFFFF" />
                                            </Grid>
                                        </ControlTemplate>
                                    </Grid.Resources>
                                    <RepeatButton x:Name="VerticalSmallDecrease"
                                                  Command="ScrollBar.LineUpCommand"
                                                  Grid.Row="0"
                                                  Height="16"
                                                  IsTabStop="False"
                                                  Interval="50"
                                                  Template="{StaticResource VerticalDecrementTemplate}"
                                                  Margin="1" />
                                    <Track Grid.Row="1"
                                           Name="PART_Track"
                                           ViewportSize="NaN"
                                           IsDirectionReversed="true">
                                        <Track.DecreaseRepeatButton>
                                            <RepeatButton Template="{StaticResource RepeatButtonTemplate}"
                                                          Command="ScrollBar.PageUpCommand" />
                                        </Track.DecreaseRepeatButton>
                                        <Track.IncreaseRepeatButton>
                                            <RepeatButton Template="{StaticResource RepeatButtonTemplate}"
                                                          Command="ScrollBar.PageDownCommand" />
                                        </Track.IncreaseRepeatButton>
                                        <Track.Thumb>
                                            <Thumb Height="30">
                                                <Thumb.Template>
                                                    <ControlTemplate TargetType="Thumb">
                                                        <Grid>
                                                            <VisualStateManager.VisualStateGroups>
                                                                <VisualStateGroup x:Name="CommonStates">
                                                                    <VisualState x:Name="Normal" />
                                                                    <VisualState x:Name="MouseOver">
                                                                        <Storyboard>
                                                                            <DoubleAnimation Duration="0:0:0"
                                                                                             Storyboard.TargetName="BackgroundMouseOver"
                                                                                             Storyboard.TargetProperty="Opacity"
                                                                                             To="1" />
                                                                            <ColorAnimation Storyboard.TargetName="BackgroundGradient"
                                                                                            Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)"
                                                                                            Duration="0"
                                                                                            To="#7FFFFFFF" />
                                                                            <ColorAnimation Storyboard.TargetName="BackgroundGradient"
                                                                                            Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)"
                                                                                            Duration="0"
                                                                                            To="#CCFFFFFF" />
                                                                            <ColorAnimation Storyboard.TargetName="BackgroundGradient"
                                                                                            Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)"
                                                                                            Duration="0"
                                                                                            To="#F2FFFFFF" />
                                                                        </Storyboard>
                                                                    </VisualState>
                                                                    <VisualState x:Name="Pressed">
                                                                        <Storyboard>
                                                                            <DoubleAnimation Duration="0:0:0"
                                                                                             Storyboard.TargetName="BackgroundPressed"
                                                                                             Storyboard.TargetProperty="Opacity"
                                                                                             To="1" />
                                                                            <DoubleAnimation Storyboard.TargetName="Highlight"
                                                                                             Storyboard.TargetProperty="(UIElement.Opacity)"
                                                                                             Duration="0"
                                                                                             To="1" />
                                                                            <ColorAnimation Storyboard.TargetName="BackgroundGradient"
                                                                                            Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)"
                                                                                            Duration="0"
                                                                                            To="#6BFFFFFF" />
                                                                            <ColorAnimation Storyboard.TargetName="BackgroundGradient"
                                                                                            Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)"
                                                                                            Duration="0"
                                                                                            To="#C6FFFFFF" />
                                                                            <ColorAnimation Storyboard.TargetName="BackgroundGradient"
                                                                                            Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)"
                                                                                            Duration="0"
                                                                                            To="#EAFFFFFF" />
                                                                            <ColorAnimation Storyboard.TargetName="BackgroundGradient"
                                                                                            Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)"
                                                                                            Duration="0"
                                                                                            To="#F4FFFFFF" />
                                                                        </Storyboard>
                                                                    </VisualState>
                                                                    <VisualState x:Name="Disabled">
                                                                        <Storyboard>
                                                                            <DoubleAnimation Duration="0:0:0"
                                                                                             Storyboard.TargetName="ThumbVisual"
                                                                                             Storyboard.TargetProperty="Opacity"
                                                                                             To="0" />
                                                                        </Storyboard>
                                                                    </VisualState>
                                                                </VisualStateGroup>
                                                            </VisualStateManager.VisualStateGroups>
                                                            <Grid x:Name="ThumbVisual"
                                                                  Margin="1,0,1,0">
                                                                <Rectangle x:Name="Background"
                                                                           RadiusX="2"
                                                                           RadiusY="2"
                                                                           Fill="#FF1F3B53"
                                                                           StrokeThickness="1">
                                                                    <Rectangle.Stroke>
                                                                        <LinearGradientBrush EndPoint="1,.5"
                                                                                             StartPoint="0,.5">
                                                                            <GradientStop Color="#FF818F99"
                                                                                          Offset="1" />
                                                                            <GradientStop Color="#FFC2C9CE"
                                                                                          Offset="0" />
                                                                            <GradientStop Color="#FFB3BBC1"
                                                                                          Offset="0.35" />
                                                                            <GradientStop Color="#FF96A4B1"
                                                                                          Offset="0.35" />
                                                                        </LinearGradientBrush>
                                                                    </Rectangle.Stroke>
                                                                </Rectangle>
                                                                <Rectangle x:Name="BackgroundMouseOver"
                                                                           Opacity="0"
                                                                           RadiusX="2"
                                                                           RadiusY="2"
                                                                           Fill="#FF448DCA"
                                                                           StrokeThickness="1"
                                                                           Stroke="#00000000" />
                                                                <Rectangle x:Name="BackgroundPressed"
                                                                           Opacity="0"
                                                                           RadiusX="2"
                                                                           RadiusY="2"
                                                                           Fill="#FF448DCA"
                                                                           StrokeThickness="1"
                                                                           Stroke="#00000000" />
                                                                <Rectangle x:Name="BackgroundGradient"
                                                                           RadiusX="1"
                                                                           RadiusY="1"
                                                                           StrokeThickness="1"
                                                                           Margin="1"
                                                                           Stroke="#FFFFFFFF">
                                                                    <Rectangle.Fill>
                                                                        <LinearGradientBrush StartPoint="0,.7"
                                                                                             EndPoint="1,.7">
                                                                            <GradientStop Color="#FFFFFFFF"
                                                                                          Offset="0" />
                                                                            <GradientStop Color="#F9FFFFFF"
                                                                                          Offset="0.375" />
                                                                            <GradientStop Color="#E5FFFFFF"
                                                                                          Offset="0.6" />
                                                                            <GradientStop Color="#C6FFFFFF"
                                                                                          Offset="1" />
                                                                        </LinearGradientBrush>
                                                                    </Rectangle.Fill>
                                                                </Rectangle>
                                                                <Rectangle x:Name="Highlight"
                                                                           RadiusX="1"
                                                                           RadiusY="1"
                                                                           Opacity="0"
                                                                           IsHitTestVisible="false"
                                                                           Stroke="#FF6DBDD1"
                                                                           StrokeThickness="1"
                                                                           Margin="1" />
                                                            </Grid>
                                                        </Grid>
                                                    </ControlTemplate>
                                                </Thumb.Template>
                                            </Thumb>
                                        </Track.Thumb>
                                    </Track>
                                    <RepeatButton x:Name="VerticalSmallIncrease"
                                                  Command="ScrollBar.LineDownCommand"
                                                  Grid.Row="4"
                                                  Height="16"
                                                  IsTabStop="False"
                                                  Interval="50"
                                                  Template="{StaticResource VerticalIncrementTemplate}"
                                                  Margin="1" />
                                </Grid>
                                <ControlTemplate.Triggers>
                                    <Trigger SourceName="PART_Track"
                                             Property="IsEnabled"
                                             Value="false">
                                        <Setter TargetName="PART_Track"
                                                Property="Visibility"
                                                Value="Hidden" />
                                    </Trigger>
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </controls:BufferViewer.Resources>
        </controls:BufferViewer>
        <Border Visibility="{Binding MoreContentAlertVisibility, FallbackValue=Collapsed}"
                Grid.Column="1"
                Grid.Row="0"
                HorizontalAlignment="Right"
                VerticalAlignment="Bottom"
                Margin="0,0,20,5"
                Panel.ZIndex="10">
            <TextBlock Text="More..."
                       Cursor="Hand"
                       Foreground="Cyan"
                       FontStyle="Italic"
                       MouseLeftButtonUp="TextBlock_MouseLeftButtonUp" />
        </Border>
        <GridSplitter Grid.Row="1"
                      Grid.ColumnSpan="2"
                      HorizontalAlignment="Stretch"
                      VerticalAlignment="Center"
                      Height="5"
                      Cursor="SizeNS"
                      Background="{StaticResource {x:Static SystemColors.ControlBrushKey}}" />
        <Grid Grid.Row="2"
              Grid.ColumnSpan="2"
              Background="{StaticResource {x:Static SystemColors.ControlBrushKey}}">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"
                               MaxHeight="80" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <nox:CommandHistory Grid.ColumnSpan="2"
                                Margin="5"
                                DataContext="{Binding CommandHistoryViewModel}"
                                Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.ShowHistory, Converter={StaticResource BooleanToVisibilityConverter}, FallbackValue=Collapsed}" />
            <TextBox Grid.Row="1"
                     SpellCheck.IsEnabled="True"
                     x:Name="inputBox"
                     AcceptsReturn="True"
                     FontFamily="Consolas"
                     FontSize="14"
                     Background="#FF191936"
                     Foreground="White"
                     TextOptions.TextFormattingMode="Display"
                     Text="{Binding Input, UpdateSourceTrigger=PropertyChanged}"
                     HorizontalScrollBarVisibility="Disabled"
                     VerticalScrollBarVisibility="Auto"
                     TextWrapping="Wrap">
                <TextBox.InputBindings>
                    <KeyBinding Command="{Binding RecallNextCommandCommand}"
                                Key="Down"
                                Modifiers="Ctrl" />
                    <KeyBinding Command="{Binding RecallPrevCommandCommand}"
                                Key="Up"
                                Modifiers="Ctrl" />
                </TextBox.InputBindings>
                </TextBox>
                    <StackPanel Grid.Row="1"
                        Grid.Column="1">
                <ToggleButton ToolTip="Command History"
                              x:Name="historyButton"
                              MinWidth="24"
                              IsChecked="{Binding ShowHistory}"
                              Margin="5">
                    <Image Source="/Amuse;component/Images/ComHistory256.png"
                           Width="24" />
                </ToggleButton>
            </StackPanel>
        </Grid>
    </Grid>
</UserControl>
